<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Amaze UI Admin table Examples</title>
<meta name="description" content="这是一个 table 页面">
<meta name="keywords" content="table">
<% include("/common/inc/_css.html"){} %>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<% include("/common/inc/_header.html"){} %>

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <% include("/common/inc/_start.html"){} %>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">菜单列表</strong> / <small>Table</small></div>
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <a href="${ctxPath}/auth/function" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</a>
            </div>
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field" name="func_name" placeholder="菜单名称">
          <span class="am-input-group-btn">
            <a href="#" class="am-btn am-btn-default" type="button" >搜索</a>
          </span>
          </div>
        </div>
      </div>

      <div class="am-g">
        <div class="am-u-sm-12">
          <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th class="table-check"><input type="checkbox" /></th>
                <th class="table-id">序号</th>
                <th class="table-title"> 菜单编码</th>
                <th class="table-title"> 菜单名称</th>
                <th class="table-title"> 菜单类型</th>
                <th class="table-title"> 访问地址</th>
                <th class="table-title"> 上级菜单</th>
                <th class="table-date am-hide-sm-only">创建日期</th>
                <th class="table-set">操作</th>
              </tr>
              </thead>
              <tbody>
                 <% for(var item in list.list!) {%>
	              <tr>
	                <td><input type="checkbox" /></td>
	                <td>${itemLP.index}</td>
	                <td><a href="#">${item.func_code}</a></td>
	                <td><a href="#">${item.func_name}</a></td>
	                <td>${item.func_type == 1?'菜单':'文件夹'}</td>    
	                <td><a href="#">${item.func_url}</a></td>
	                <td><a href="#">${item.parent_id}</a></td>
	                <td>${item.update_time,'yyyy-MM-dd hh:mm:ss'}</td>
	                <td>
	                  <div class="am-btn-toolbar">
	                    <div class="am-btn-group am-btn-group-xs">
	                      <a href="${ctxPath}/auth/function/${item.id}" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</a>
	                      <a onclick="deleteFunction('${item.id}')" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</a>
	                    </div>
	                  </div>
	                </td>
	              </tr>          
	              <%}%>
                </tbody>
            </table>
            <div class="am-cf"> 
            	<span>共  ${list.totalCount} 条数据</span>&nbsp;&nbsp;
	            <span>当前第 ${list.pageNum} 页</span>&nbsp;&nbsp;
	            <span>共  ${list.totalPage} 页  </span>
              <div class="am-fr">
                <% 
	             var curUrl = ctxPath + "/auth/function/list";
	             include("/common/inc/_page.html",{pageUrl:curUrl}){}              
		        %>
              </div>
            </div>
            <hr />
          </form>
        </div>

      </div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <!-- content end -->
</div>

<!-- 删除提示 -->
<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd">删除提示</div>
    <div class="am-modal-bd">确定要删除这条记录吗？</div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
    </div>
  </div>
 </div>
<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<footer>
  <hr>
  <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
</footer>
<% include("/common/inc/_js.html"){} %>

<script type="text/javascript">
	function deleteFunction(id){
		  $('#my-confirm').modal({
		      relatedTarget: this,
		      onConfirm: function(options) {
		    	  $.ajax({
		          	  url:'${ctxPath }/auth/function/'+id,
		          	  type:'delete',
		          	  success:function(){
		          		 	window.location.reload(); //删除成功，刷新页面
		          	  }
		            })
		      }		       
		  });
	}
</script>
</body>
</html>
